package leecode

import "strings"

func letterCasePermutation(s string) []string {
	//先将其全部转化为小写 A 65 a 97
	s = strings.ToLower(s)
	var result []string
	var backtrack func(str []byte, start int)
	backtrack = func(str []byte, start int) {
		result = append(result, string(str))
		for i := start; i < len(str); i++ {
			if str[i] >= 'a' && str[i] <= 'z' {
				str[i] = str[i] - 32
				backtrack(str, i+1)
				str[i] = str[i] + 32
			}
		}
	}
	backtrack([]byte(s), 0)
	return result
}
